<template>
  <view class="cashListContainer">
    <view class="" v-for="data in list" style="margin-bottom: 16rpx;" @click="cashDetail(data._id)" :key="data._id">
      <cash-list :cashInfo="data"></cash-list>
    </view>

  </view>
</template>

<script>
  import cashList from "@/components/cashList/cashList.vue"
  import {
    store
  } from "../../uni_modules/uni-id-pages/common/store";
  export default {
    data() {
      return {
        type: null, //collect,fished
        list: []
      };
    },
    components: {
      cashList
    },
    async onLoad(op) {
      this.type = op.type
      let title = '',
        flag = 3
      if (this.type == "collect") {
        title = "我的收藏"
      } else {
        title = "已完成记录"
        flag = 4
      }
      uni.setNavigationBarTitle({
        title
      })
      let res = await uniCloud.callFunction({
        name: "getMyPageInfo",
        data: {
          flag,
          userID: store.userInfo._id
        }
      })
      this.list = res?.result?.data || []
    },
    methods: {
      cashDetail(event) {
        console.log("点击案例跳转详情页", event);
        event.view_count = view_count + 1
        uni.navigateTo({
          url: "/pages/cashRead/cashRead?cash_id=" + event
        })
      },
    }
  }
</script>

<style lang="scss">
  .cashListContainer {
    min-height: 100vh;
    background-color: #f0f0f0;
    padding: 0 30rpx;
  }
</style>